package deployr.core;

import java.io.*;

public class Slurp {

	public static String slurp(File file) {
		try {
			return slurp(new FileInputStream(file));
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	public static String slurp(InputStream in) {
		try {
			StringBuffer out = new StringBuffer();
			byte[] b = new byte[4096];
			for (int n; (n = in.read(b)) != -1;) {
				out.append(new String(b, 0, n));
			}
			return out.toString();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

}
